package com.hec.yygh.oss.controller;

import com.hec.yygh.common.result.R;
import com.hec.yygh.oss.service.FileService;
import com.hec.yygh.oss.utils.QiniuUtils;
import com.hec.yygh.result.Result;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.UUID;

@RestController
@RequestMapping("/admin/oss/file")
public class ossController {

    @Autowired
    private FileService fileService;

    @PostMapping("/upload")
    public R upload(@RequestParam("file") MultipartFile file){
        String uploadurl = fileService.upload(file);
        return R.ok().data("url",uploadurl);
    }



}
